package com.yixun.qfbao.xf.model.enums;

import com.yixun.common.utils.EnumUtil;
import org.apache.commons.lang.StringUtils;

public enum HouseStructEnum {
    type_0("0","多层"),
    type_1("1","高层"),
    type_2("2","小高层"),
    type_3("3","多层复式"),
    type_4("4","高层复式"),
    type_5("5","多层跃式"),
    type_6("6","高层跃式"),
    type_7("7","独立别墅"),
    type_8("8","联体别墅"),
    type_9("9","双拼别墅"),
    type_10("10","叠加别墅"),
    type_11("11","四合院"),
    type_12("12","洋房");

    private final String no;
    private final String des;
    static{
        EnumUtil.ENUMS_TO_VIEW.put("building_type", BuildingTypeEnum.values());
    }

    /**
     * 私有构造函数
     * @param no
     * @param des
     */
    HouseStructEnum(String no, String des) {
        this.no = no;
        this.des = des;
    }

    /**
     * @return Returns the no.
     */
    public String getNo() {
        return no;
    }

    /**
     * @return Returns the des.
     */
    public String getDes() {
        return des;
    }

    /**
     * 通过枚举<code>des</code>获得枚举
     *
     * @param des
     * @return
     */
    public static HouseStructEnum getByDescription(String des) {
        if(StringUtils.isBlank(des)){
            return null;
        }
        for (HouseStructEnum menum : values()) {
            if (menum.getDes().equals(des)) {
                return menum;
            }
        }
        return null;
    }
    public static HouseStructEnum getByNo(String no) {
        if(StringUtils.isBlank(no)){
            return null;
        }
        for (HouseStructEnum menum : values()) {
            if (menum.getNo().equals(no)) {
                return menum;
            }
        }
        return null;
    }
}
